package kr.co.boogui.actions.admin.movie;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import kr.co.boogui.actions.ActionHandler;
import kr.co.boogui.service.AdminService;

public class RegistryMovieAction implements ActionHandler {
	@Override
	public String execute(HttpServletRequest req, HttpServletResponse res)
			throws ServletException, IOException {
		
		String viewPage = "f|/WEB-INF/jsp/admin/admin.jsp";
		String method = req.getMethod();
		if (method.equalsIgnoreCase("get")){
			viewPage = AdminService.adminChk(req, "movie_registry");
		} else if (method.equalsIgnoreCase("post")) {		
			req.setAttribute("action", "movie_registry.jsp");
			req.setAttribute("regi", "y");
			if (AdminService.movieRegistry(req)){
				req.setAttribute("isregi", "success");
			} else {
				req.setAttribute("isregi", "fail");
			}
		}
		return viewPage;
	}
}
